#include "treatmentwidget.h"

treatmentWidget::treatmentWidget(QWidget *parent) : QWidget(parent)
{
    // 创建主布局
       QVBoxLayout *mainLayout = new QVBoxLayout(this);

       // 创建第一个 GroupBox
       QGroupBox *infoGroupBox = new QGroupBox("患者信息", this);
       QHBoxLayout *infoLayout = new QHBoxLayout(infoGroupBox);

       appointmentNumberLabel = new QLabel("预约号:", this);
       appointmentNumberEdit = new QLineEdit(this);
       appointmentNumberEdit->setReadOnly(true); // 设置为只读
       infoLayout->addWidget(appointmentNumberLabel);
       infoLayout->addWidget(appointmentNumberEdit);

       patientNameLabel = new QLabel("患者姓名:", this);
       patientNameEdit = new QLineEdit(this);
       patientNameEdit->setReadOnly(true); // 设置为只读
       infoLayout->addWidget(patientNameLabel);
       infoLayout->addWidget(patientNameEdit);

       mainLayout->addWidget(infoGroupBox);

       // 创建第二个 GroupBox
       QGroupBox *conditionGroupBox = new QGroupBox("病情", this);
       QVBoxLayout *conditionLayout = new QVBoxLayout(conditionGroupBox);

       conditionTextEdit = new QTextEdit(this);
       conditionLayout->addWidget(conditionTextEdit);

       mainLayout->addWidget(conditionGroupBox);

       // 创建第三个 GroupBox
       QGroupBox *prescriptionGroupBox = new QGroupBox("处方", this);
       QVBoxLayout *prescriptionLayout = new QVBoxLayout(prescriptionGroupBox);

       prescriptionTextEdit = new QTextEdit(this);
       prescriptionLayout->addWidget(prescriptionTextEdit);

       mainLayout->addWidget(prescriptionGroupBox);
}
treatmentWidget::~treatmentWidget(){

}
void treatmentWidget::setPatientInfo(const QString &appointmentNumber,const QString &patientName)
{
    appointmentNumberEdit->setText(appointmentNumber);
        patientNameEdit->setText(patientName);
}
